﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HPortal.Lib;

namespace HPortal.Module
{
    public partial class ControlHotNews : PanelControl
    {
        private int ChannelID;

        protected void Page_Load(object sender, EventArgs e)
        {
            ChannelID = DatabaseHelper.SelectScalarIntFromID("ChannelID", "Panel", PanelID);
            Repeater1.DataSource = DatabaseHelper.Select("exec getTopNews");
            Repeater1.DataBind();
        }

        public string WriteArticleImage(object ImageType, int ArticleID_, string Url)
        {
            if (ImageType != System.DBNull.Value)
            {
                string st = "<a href='default.aspx?url=" + Url + "&ArticleID=" + ArticleID_ + "&PanelID=" + base.PanelID + "&ChannelID=" + ChannelID + "'>";
                st += "<img src='imgView.aspx?ArticleID=" + ArticleID_ + "' class='HeadImage' />";
                st += "</a>";
                return st;
            }
            return string.Empty;
        }
    }
}